home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
JCSM Shareware Collection 1996 September
/
JCSM Shareware Collection (JCS Distribution) (September 1996).ISO
/
tutorial
/
trac.zip
/
EX-III-1.TRA
< prev
next >
Wrap
Text File
|
1990-01-24
|
1KB
|
41 lines
0002 0 Origin to define I as 3
I 0
0009 0 Re-origin past index registers
STRT RDMAX Read in number of values
LDZERO Load zero
STI Initialize I
READ 3RDX Read a X(I)
LDI Load I
ADONE Add 1
STI Save new I
SUMAX Subtract MAX
BNREAD If I < MAX go back to READ
LDZERO
STI Initialize I
STS Initialize S
STS2 Initialize S2
LOOP 3LDX Load X(I)
ADS Add S
STS Store at S
3LDX Load X(I)
3MUX Multiply by X(I)
ADS2 add S2
STS2 Store at S2
LDI Increment I
ADONE
STI
SUMAX Test for done
BNLOOP Repeat loop if not done
PCMAX Display MAX, S, S2
HT0000 Halt
MAX 0 Reserve read area for MAX
S 0 Put S here for output
S2 0 Put S2 here for output
0 Reserve 2 locations for read and print
0
ZERO 0 Constant ZERO
ONE 1 Constant 1
0999 0 Re-origin for array X
X 0 Starts X at 1000, can use rest of memory
ENSTRT End-of-code